package com.kaver.sso.web.aop;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 全局的的异常拦截器（拦截所有的控制器）（带有@RequestMapping注解的方法上都会拦截）
 *
 * @author guopeng
 */
@ControllerAdvice(basePackages = "com.kaver.sso.web.controller.page")
@Order(-1)
public class WebGlobalExceptionHandler {

	private final static Logger logger = LoggerFactory.getLogger(WebGlobalExceptionHandler.class);
	/**
     * 拦截系统异常
     */
    @ExceptionHandler(Exception.class)
    public String exc(Exception e) {
        logger.error("Exception error", e);
        return "error";
    }
}